import * as actionType from "./actionType"
import { PreLoanMangeApi } from '../../http/preLoanApi'

export const PreLoanMangeAction = (arr) => ({
    type: actionType.PRE_NOGET,
    arr,
})
export const EditIdAction = (id) => ({
    type: actionType.EDIT_ID,
    id,
})


// 获取数据异步
export const PreLoanMangeAsyncAction = (obj) => (dispatch) =>
    PreLoanMangeApi(obj)
        .then((res) => {
            if (res.data.code === 200) {
                dispatch(PreLoanMangeAction([...res.data.data]))
                // console.log('res',res.data)
                console.log('数据申请成功', res.data)
                return Promise.resolve('ok')
            } else {
                return Promise.reject('fail')
            }
        })
        .catch((err) => {
            console.log('数据申请失败', err)
            return Promise.reject('fail')
        })


